#!/bin/bash

name=""

if [ $# -eq 1 ]; then
    name=$1;
else 
    echo "参数个数不正确"
    exit 2
fi
  
filename="$name.proto"

protoc $filename --cpp_out=. 

if [ $? -ne 0 ]; then
    echo "create proto cpp file error."
    exit 2
fi

mv $name.pb.cc $name.pb.cpp
